<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Order_analyze extends AdminController{
    public $_validation = null;

    function __construct()
    {
        parent::__construct();
        $this->load->model('MOrder');
    }

    public function index()
    {
        $this->load->library('FormFilter');
        $this->load->helper('formfilter');
        $this->layout('order.tpl');
    }

    public function ajaxBlockData()
    {
        $this->load->library('FormFilter');
        $this->load->helper('formfilter');
        $begintime = filterValue('order_create_time_begin');
        $endtime = filterValue('order_create_time_end');
        $list = $this->MOrder->getStaticData($begintime, $endtime);
        $info = $this->MOrder->getInfo($begintime, $endtime);
        $return = [
            'num' => $list['num'],
            'ing_num' => $list['ing_num'],
            'apply_num' => $list['apply_num'],
            'wait_pay' => $list['wait_pay'],
            'complete' => $list['complete'],
            'amount' => $list['amount'],
            'line' => $list['line'],
            'other' => $info
        ];
        exit(json_encode([
            'success' => 1,
            'msg' => '获取成功',
            'data' => $return
        ]));
    }

    public function ajaxDetail(){
        $this->load->library('FormFilter');
        $this->load->helper('formfilter');
        $beginTime = filterValue('task_operate_create_time_begin');
        $endTime = filterValue('task_operate_create_time_end');
        $this->load->model('MTaskRecords');
        $list = $this->MTaskRecords->getStaffDetail($this->input->post('person'), $this->input->post('group_id'), $beginTime, $endTime);

        exit(json_encode([
            'success' => 1,
            'msg' => '获取成功',
            'data' => $list
        ]));
    }

}
